package com.wcar.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 余额
 * @TableName tb_user_balance
 */
@TableName(value ="tb_user_balance")
public class UserBalance implements Serializable {
    /**
     * 余额ID
     */
    @TableId(type = IdType.AUTO)
    private Integer balanceId;

    /**
     * 店铺id，外键关联电偶表
     */
    private Integer storeId;

    /**
     * 用户ID，外键关联用户表
     */
    private Integer userId;

    /**
     * 账户余额，保留两位小数
     */
    private BigDecimal amount;

    /**
     * 余额记录创建时间
     */
    private Date balanceTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 余额ID
     */
    public Integer getBalanceId() {
        return balanceId;
    }

    /**
     * 余额ID
     */
    public void setBalanceId(Integer balanceId) {
        this.balanceId = balanceId;
    }

    /**
     * 店铺id，外键关联电偶表
     */
    public Integer getStoreId() {
        return storeId;
    }

    /**
     * 店铺id，外键关联电偶表
     */
    public void setStoreId(Integer storeId) {
        this.storeId = storeId;
    }

    /**
     * 用户ID，外键关联用户表
     */
    public Integer getUserId() {
        return userId;
    }

    /**
     * 用户ID，外键关联用户表
     */
    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    /**
     * 账户余额，保留两位小数
     */
    public BigDecimal getAmount() {
        return amount;
    }

    /**
     * 账户余额，保留两位小数
     */
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    /**
     * 余额记录创建时间
     */
    public Date getBalanceTime() {
        return balanceTime;
    }

    /**
     * 余额记录创建时间
     */
    public void setBalanceTime(Date balanceTime) {
        this.balanceTime = balanceTime;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserBalance other = (UserBalance) that;
        return (this.getBalanceId() == null ? other.getBalanceId() == null : this.getBalanceId().equals(other.getBalanceId()))
            && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
            && (this.getBalanceTime() == null ? other.getBalanceTime() == null : this.getBalanceTime().equals(other.getBalanceTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getBalanceId() == null) ? 0 : getBalanceId().hashCode());
        result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
        result = prime * result + ((getBalanceTime() == null) ? 0 : getBalanceTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", balanceId=").append(balanceId);
        sb.append(", storeId=").append(storeId);
        sb.append(", userId=").append(userId);
        sb.append(", amount=").append(amount);
        sb.append(", balanceTime=").append(balanceTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}